package com.control.qct.businesssteward.adapter;

import android.support.annotation.Nullable;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.control.qct.businesssteward.R;
import com.control.qct.businesssteward.model.StoreModel;

import java.util.List;

public class StoreSelectAdapter extends BaseQuickAdapter<StoreModel, BaseViewHolder> {
    private int mPosition = -1;

    public StoreSelectAdapter() {
        super(R.layout.rv_store_select_item);
    }

    @Override
    protected void convert(BaseViewHolder holder, StoreModel item) {
        holder.setText(R.id.tv_store_name, item.getTitle()).setText(R.id.tv_store_id, "（" + item.getStoreId() + "）")
                .setGone(R.id.iv_store_select, mPosition == holder.getAdapterPosition());
    }

    public void setPosition(int position) {
        mPosition = position;
        notifyDataSetChanged();
    }
}
